public class L2022SB2 {
    public static boolean IHUI(int x) {
        StringBuffer sb = new StringBuffer("" + x);
        return sb.reverse().toString().equals(sb.toString());
    }

    public static void main(String[] args) {
        int ans = 0;
        for (Integer i = 2022; i <= 2022222022; i++) {
            if (IHUI(i)) {
                boolean isOK = true;
                int tmp = i;
                int wei = 0;
                while (tmp != 0) {
                    wei++;
                    tmp /= 10;
                }
                if (wei % 2 == 0) {
                    wei = wei / 2;
                } else {
                    wei = wei / 2 + 1;
                }
                char[] arr = i.toString().toCharArray();
                for (int j = 1; j < wei; j++) {
                    if (arr[j - 1] > arr[j]) {
                        isOK = false;
                        break;
                    }
                }
                if(isOK) ans++;
            }
        }
    }
}